﻿CREATE VIEW [acms].[Menu_View]
AS 
	SELECT 
		a.Id,
		a.SiteId,
		a.Name,
		a.ParentId,
		case
			when(b.Id is null) then null
			else isNull(b.ParentPath, '') + b.Name
		end as ParentPath,
		a.IncludeParent,
		a.DefaultForAllPosts,
		a.VersionId
	FROM [acms].[Menus] a
		left outer join [acms].[Post_View] b on a.ParentId = b.Id
	Where Deleted = 0
;